package com.xianbeiying.app.ckgl.activity;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.xianbeiying.app.ckgl.R;

/**
 * 历史数据
 * */
public class HistoryDataActivity extends FragmentActivity implements View.OnClickListener{
    //水平滑动的
    private LinearLayout ly_hthorizontal;
    private ImageView iv_title_left;
    private TextView tv_title;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_history_data);
        initView();
    }

    private void initView() {
        ly_hthorizontal=(LinearLayout) findViewById(R.id.ly_hthorizontal);
        iv_title_left=(ImageView) findViewById(R.id.iv_title_left);
        tv_title=(TextView) findViewById(R.id.tv_title);
        getData();
        tv_title.setText("历史数据");
        iv_title_left.setOnClickListener(this);
    }
    private void getData(){
        for (int i = 0; i <5; i++) {
            //每个textview的宽度
            View view = LayoutInflater.from(this).inflate(R.layout.fragment_va_item,null);
            LinearLayout ly_va_cicy = (LinearLayout) view.findViewById(R.id.ly_va_cicy);
            final TextView tv_va_cicy = (TextView) view.findViewById(R.id.tv_va_cicy);
            tv_va_cicy.setText((i+1)+"\n号棚");
            ly_hthorizontal.addView(view);
            ly_va_cicy.setOnClickListener(new View.OnClickListener(){
                @Override
                public void onClick(View v){
                    // TODO Auto-generated method stub
//                    int m = (Integer) v.getTag();
//
//                    startActivity(new Intent(HistoryDataActivity.this,RealTimeModeActivity.class));
                }
            });
        }
    }
    @Override
    public void onClick(View v) {
         switch (v.getId()){
             case R.id.iv_title_left:
                 finish();
                 break;
         }
    }
}
